package com.ruoyi.web.controller.custom;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.utils.EmailSender;
import com.ruoyi.web.utils.EmailTemplateEnum;
import com.ruoyi.web.utils.TimeFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;

/**
 * 员工花名册Controller
 *
 * @author ruoyi
 * @date 2022-04-28
 */
@Controller
@RequestMapping("/system/rnx/test/")
public class RnxTestController extends BaseController {

	@Autowired
	private EmailSender mailSender;

	@GetMapping(value = "sendMail")
	@ResponseBody
	public AjaxResult sendMail() {
		//发送邮件
		mailSender.send(
				EmailTemplateEnum.NEW_USER_COMPLETE_INFORMATION_ENTRY,
				new HashMap(2) {{
					put("user", "测试");
					put("date", TimeFormatUtils.getNowWithYMDHMS());
				}});
		return AjaxResult.success();
	}

}
